const koa = require('koa')
const compose = require('koa-compose')
const app = new koa()

const logger = (ctx, next) => {
  console.log(`${Date.now()} ${ctx.request.method} ${ctx.request.url}`)
  next()
}

const main = ctx => {
  ctx.response.body = 'hello world'
}

const middlewares = compose([logger,main])

app.use(middlewares)
// app.use(main)

app.listen(3000, () => {
  console.log('服务已启动')
})
